import type { RouteRecordRaw } from "vue-router";
const icons = import.meta.glob('@/assets/aside/*.png', { eager: true }) as Record<string, { default: string }>;
const iconMap = Object.fromEntries(
  Object.entries(icons).map(([key, value]) => [
    key.match(/\/([^/]+)\.png$/)?.[1] || '', 
    value.default
  ])
);
export const Layout = () => import("@/views/Layout/index.vue")
export const staticRoutes: Array<RouteRecordRaw> = [
    {
      path: "/login",
      name: "Login",
      component: () => import("@/views/login/index.vue"),
      meta: {
        isShow: false,
        title:'登录'
      },
    },
    {
      path: "/404",
      meta: { title: "404", isShow: false },
      component: () => import("@/views/404/index.vue"),
    },
    {
      path: '/',
      component: Layout,
      redirect: "/home",
      meta: { title: "", icon: "", isShow: false },
      children: [
        {
          path: "/home",
          name: "home",
          component: () => import("@/views/home/index.vue"),
          meta: { title: "menus.home",  isShow: true,icon:iconMap['home'] }
        },
      ],
    },
]

/**
 * @动态路由 
 */
export const allAsyncRoutes = [
  { 
    path:"/",
    name:"RootNetworkAccessManagement",
    redirect:"/networkAccessManagement",
    component:Layout,
    meta:{
      title:'',
      isShow:false
    },
    children:[
      {
      path:"/networkAccessManagement",
      name:"networkAccessManagement",
      component: () => import('@/views/functionService/networkAccessManagement/index.vue'),
      meta:{
      title:'menus.networkAccessManagement',
      isShow:true,
      icon:iconMap['networkAccessManagement']
    }
  },
  ]
  },
  {
    path:"/",
    name:"RootAntennaManage",
    redirect:"/antennaManage",
    component:Layout,
    meta:{
      title:'',
      isShow:false
    },
    children:[
      {
        path:"/antennaManage",
        name:"antennaManage",
        component: () => import('@/views/antennaManage/index.vue'),
        meta:{
          title:'menus.antennaManage',
          isShow:true,
          icon:iconMap['antenna']
        }
      }
    ]
  }, 
  {
    path:"/",
    name:"RootStarManage",
    redirect:"/starManage",
    component:Layout,
    meta:{
      title:'',
      isShow:false
    },
    children:[
      {
        path:"/starManage",
        name:"starManage",
        component: () => import('@/views/starManage/index.vue'),
        meta:{
          title:'menus.starManage',
          isShow:true,
          icon:iconMap['xingli']
        }
      }
    ] 
  },
  {
    path:"/networkConfig",
    name:"RootNetworkConfig",
    component:Layout,
    meta:{
      title:'menus.networkConfig',
      isShow:true,
      icon:iconMap['networkConfig']
    },
    children:[
      {
        path:"/networkConfig/basicConfig",
        name:"basicConfig",
        component: () => import('@/views/networkConfig/basicConfig/index.vue'),
        meta:{
          title:'menus.basicConfig',
          isShow:true,
          icon:iconMap['basicConfig']
        }
      },
      {
        path:"/networkConfig/dnnConfig",
        name:"dnnConfig",
        component: () => import('@/views/networkConfig/dnnConfig/index.vue'),
        meta:{
          title:'menus.dnnConfig',
          isShow:true,
          icon:iconMap['dnnConfig']
        }
      },
      {
        path:"/networkConfig/networkTest",
        name:"networkTest",
        component: () => import('@/views/networkConfig/networkTest/index.vue'),
        meta:{
          title:'menus.networkTest',
          isShow:true,
          icon:iconMap['networkTest']
        }
      },
    ]
  },
  {
    path:"/functionService",
    name:"RootFunctionService",
    component:Layout,
    meta:{
      title:'menus.functionService',
      isShow:true,
      icon:iconMap['functionService']
    },
    children:[
      {
        path:"/functionService/logManage",
        name:"logManage",
        component: () => import('@/views/functionService/logManage/index.vue'),
        meta:{
          title:'menus.logManage',
          isShow:true,
          icon:iconMap['logManage']
        }
      },
      {
        path:"/functionService/basebandControl",
        name:"basebandControl",
        component: () => import('@/views/functionService/basebandControl/index.vue'),
        meta:{
          title:'menus.basebandControl',
          isShow:true,
          icon:iconMap['basebandControl']
        }
      },
     /*  {
        path:"/functionService/basebandFtp",
        name:"basebandFtp",
        component: () => import('@/views/functionService/basebandFtp/index.vue'),
        meta:{
          title:'menus.basebandFtp',
          isShow:true,
          icon:iconMap['ftp']
        }
      }, */    
      {
        path:"/functionService/virtualTerminal",
        name:"virtualTerminal",
        // component: () => import('@/views/functionService/virtualTerminal/index.vue'),
        meta:{
          title:'menus.virtualTerminal',
          isShow:true,
          icon:iconMap['virtualTerminal']
        }
      }
    ]
  },
  {
    path:"/deviceManage",
    name:"RootDeviceManage",
    component:Layout,
    meta:{
      title:'menus.deviceManage',
      isShow:true,
      icon:iconMap['deviceManage']
    },
    children:[
      {
        path:"/deviceManage/versionManage",
        name:"versionManage",
        component: () => import('@/views/deviceManage/versionManage/index.vue'),
        meta:{
          title:'menus.versionManage',
          isShow:true,
          icon:iconMap['versionManage']
        }
      },
      {
        path:"/deviceManage/configManage",
        name:"configManage",
        component: () => import('@/views/deviceManage/configManage/index.vue'),
        meta:{
          title:'menus.configManage',
          isShow:true,
          icon:iconMap['configManage']
        }
      },
      {
        path:"/deviceManage/powerManage",
        name:"powerManage",
        component: () => import('@/views/deviceManage/powerManage/index.vue'),
        meta:{
          title:'menus.powerManage',
          isShow:true,
          icon:iconMap['powerManage']
        }
      },
      {
        path:"/deviceManage/hardwareInformation",
        name:"hardwareInformation",
        component: () => import('@/views/deviceManage/HardwareInformation/index.vue'),
        meta:{
          title:'menus.hardwareInformation',
          isShow:true,
          icon:iconMap['deviceManage']
        }
      }

    ]
  },
]



/***
 * @任意路由
 */
export const anyRouter = [
  {
    path: "/:pathMatch(.*)*",
    name: 'Any',
    meta: { title: "任意路由", isShow: false },
    redirect: "/404",
  },
]